package cn.gjxblog.api;


import cn.gjxblog.common.model.HttpResult;
import cn.gjxblog.common.model.PageCondition;
import cn.gjxblog.model.entity.User;
import cn.gjxblog.model.entity.UserMsg;
import com.github.pagehelper.PageInfo;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author gjx
 * @version v1.0
 * @Description
 * @date 2018/12/7 16:49
 */
@FeignClient(value = "user-server",path = "/user")
public interface UserServiceFegin {

    @PostMapping("/addUserMsg")
   HttpResult addUserMsg(@RequestBody UserMsg userMsg);

     @GetMapping("/getUserById")
     HttpResult<User> getUserById(@RequestParam("id") String id);

     @GetMapping("/getUserByEmail")
     HttpResult<User> getUserByEmail(@RequestParam("email") String email);

     @PostMapping("/queryUser")
     HttpResult<List<User>> queryUser(@RequestBody User user);

     @PostMapping("/addUser")
     HttpResult addUser(@RequestBody User user,@RequestParam("enableUrl")String enableUrl);

     @GetMapping("/enable")
     HttpResult enable(@RequestParam("key") String key);

     @PostMapping("/auth")
     HttpResult<String> auth(@RequestBody User user);

     @GetMapping("/getUserByToken")
     HttpResult<User> getUserByToken(@RequestParam("token") String token);


    @GetMapping("/logout")
    HttpResult logout(@RequestParam("token") String token);

    @PostMapping("/updateUser")
    HttpResult<User> updateUser(@RequestBody User user);

    @GetMapping("/resetNotify")
    HttpResult<User> resetNotify(@RequestParam("email") String email,@RequestParam("url") String url);

    @GetMapping("/getEmailByKey")
    HttpResult<String> getEmailByKey(@RequestParam("key")String key);

    @GetMapping("/resetPwd")
    HttpResult<User> resetPwd(@RequestParam("key") String key ,@RequestParam("password") String password);


     @PostMapping("/queryUserMsgByUserId")
     HttpResult<PageInfo<UserMsg>> queryUserMsgByUserId(@RequestParam("userId") String userId,@RequestBody PageCondition pageCondition);

    @PostMapping("/queryUserMsgByAgentId")
    HttpResult<PageInfo<UserMsg>> queryUserMsgByAgentId(@RequestParam("agentId") String userId,@RequestBody PageCondition pageCondition);

}
